package com.chenjj.java.test.thread.waitnotify;

import com.chenjj.java.thread.waitnotify.Consumer;
import com.chenjj.java.thread.waitnotify.Produce;
import org.junit.Test;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;

public class WaitNotifyTester {

    @Test
    public void test1() throws InterruptedException {
        Object lock = new Object();
        AtomicInteger product = new AtomicInteger(0);
        Produce p = new Produce(product,lock);
        Consumer c = new Consumer(product,lock);

        ExecutorService executorService = Executors.newFixedThreadPool(20);
        executorService.execute(p);
        executorService.execute(c);



        for (int i=0; i<50; i++){
            Thread.sleep(1000);
        }


    }
}
